<?php

use think\migration\Migrator;
use think\migration\db\Column;

class ControlPlanName extends Migrator
{
    /**
     * 管控-预案
     */
    public function change()
    {
        $table = $this->table('control_plan_name');
        $table
            //step1:预案相关
            ->addColumn('plan_name', 'string', ['limit' => 50, 'comment'=>'预案名称',])
            ->addColumn('plan_type', 'integer', ['limit' => 5, 'comment'=>'预案类型',])
            ->addColumn('plan_number', 'string', ['limit' => 200, 'comment'=>'预案编号',])

            //step2:管控相关
            ->addColumn('control_start_time', 'datetime', [ 'comment'=>'管控开始时段',])
            ->addColumn('control_end_time', 'datetime', [ 'comment'=>'管控结束时段',])
            ->addColumn('response_start_time', 'datetime', ['comment'=>'要求响应开始时段',])
            ->addColumn('response_end_time', 'datetime', ['comment'=>'要求响应结束时段',])
            ->addColumn('bureau_plan_id', 'string', ['comment'=>'气象台的预案ID,如：0001到9999',])

            //step3:插入时间
            ->addColumn('create_time', 'integer', ['comment' => '插入时间'])

            //step4:叛逆管控目标制定的ID

            //注释
            ->setComment('管控 - 预案名称')

            //引擎
            ->setEngine('InnoDB')
            ->save();
    }
}
